package demo;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.List;

import lib.ConnectionWeb;

import org.htmlcleaner.CleanerProperties;
import org.htmlcleaner.HtmlCleaner;
import org.htmlcleaner.TagNode;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.select.Elements;





public class demo {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub

		String link= "http://www.songhuong.com.vn";
		ConnectionWeb con = new ConnectionWeb();
		
		HtmlCleaner htmlCleaner = new HtmlCleaner();
		CleanerProperties props = htmlCleaner.getProperties();
		 
		// set some properties to non-default values
		props.setTranslateSpecialEntities(true);
		props.setTransResCharsToNCR(true);
		props.setOmitComments(true);
		 
		// do parsing
		TagNode root = new HtmlCleaner(props).clean(
		    new URL(link)
		);
		
		TagNode root2= con.getInfo(link);
		
		
		String url = "http://saigoncom.vn/";
		String xpath="/html/body/div[6]/div[3]/div[2]/div[3]/div[2]/div/ul/li/ul";
		Document doc = Jsoup.connect(link)
				.data("query", "Java")
		  .userAgent("Mozilla")
		  .cookie("auth", "token")
		  .timeout(3000)
		  .post();
		

		Elements d= doc.getElementsByTag("body");
		Elements d1= doc.getElementsByTag("body").first().children();
		Elements e = doc.children();
		Element e1 = e.get(0);
		
		Elements e2=e1.children();
		Element e3 = e2.get(0);
	}
}
